﻿Public Class frmEditInstrument

    Private c_Instrument As clsInstrument

    Friend Property Instrument() As clsInstrument
        Get
            Return c_Instrument
        End Get
        Set(ByVal value As clsInstrument)
            c_Instrument = value
        End Set
    End Property

    Private Sub frmEditInstrument_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not c_Instrument Is Nothing Then
            txtName.Text = c_Instrument.Name
            txtFXPPath.Text = c_Instrument.fxpPath
            txtVST.Text = c_Instrument.VSTInstrument
        End If

    End Sub


    Private Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
        If txtName.Text = "" Then
            MsgBox("Enter a name", MsgBoxStyle.OkOnly)
        ElseIf txtFXPPath.Text = "" Then
            MsgBox("Enter a path for the FXP", MsgBoxStyle.OkOnly)
        ElseIf txtVST.Text = "" Then
            MsgBox("Enter the VST name", MsgBoxStyle.OkOnly)
        Else
            c_Instrument = New clsInstrument()
            With c_Instrument
                .Name = txtName.Text
                .fxpPath = txtFXPPath.Text
                .VSTInstrument = txtVST.Text
            End With
            Me.DialogResult = Windows.Forms.DialogResult.OK
        End If

    End Sub

    Private Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub


End Class